﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection; 

using FluentNHibernate.Cfg.Db;

using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;

using Domain.Model;
using Domain.Model.Abstract;


namespace DataAccess.Utils
{
    public class DataAccessConfiguration
    {
        /*
         * Database configuration 
         * 
         * MS SQL Server 2008
         * ------------------
         */

        private static string MsSqlServerUrl = "localhost\\SQLEXPRESS";
        private static string MsSqlDataBase = "PortfolioDB";
        private static string MsSqlUserName = "aasd-group6";
        private static string MsSqlPassword = "aasd-group6";

        private static string ConString = "Server=" + MsSqlServerUrl + "; " +
                                          "Database=" + MsSqlDataBase + "; " +
                                          "User Id=" + MsSqlUserName + "; " +
                                          "Password=" + MsSqlPassword + ";";


        public static MsSqlConfiguration MsSqlServerAccessConfiguration()
        {
            return MsSqlConfiguration.MsSql2008
                   .ConnectionString(ConString)
                   .ShowSql();
        }

        /*
         * Database configuration 
         * 
         * Postgres SQL Server
         * -------------------
         */

        private static string PostgreSqlServerUrl = "";
        private static string PostgreSqlDataBase = "";
        private static string PostgreSqlUserName = "";
        private static string PostgreSqlPassword = "";

        public static PostgreSQLConfiguration PostgreSqlServerAccessConfiguration()
        {
            throw new NotImplementedException("Configuration for PostgreSql server has been defined!");
        }

        /*
         * Schema export
         * -------------
         */
        public static void ExportSchema(Configuration Config)
        {
            new SchemaExport(Config).SetOutputFile(@"C:\temp\PortfolioManagementSystem_DB.sql").Create(false, true);
        }
    }
}